//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_EXCEPTION_H__
#define __ELASTOS_EXCEPTION_H__

EXTERN_C void DoBpHandle(InterruptContext *pContext);
EXTERN_C int  DoRI (InterruptContext *pContext);
EXTERN_C void DoTlbDoubleFault(InterruptContext *pContext, Address badAddr);
EXTERN_C void DoCacheError(InterruptContext *pContext);
EXTERN_C void DoGenericException(InterruptContext *pContext);
EXTERN_C void DoFpuException(InterruptContext *pContext);
EXTERN_C void DoCopException(InterruptContext *pContext);
EXTERN_C void DoSysCallException(InterruptContext *pContext);
EXTERN_C void DoIrqDispatch(InterruptContext *pContext);
EXTERN_C void HandleInterrupt(irq_t irq, InterruptContext *pContext);
EXTERN_C void DoTLBModException(InterruptContext *pContext);
EXTERN_C void DoAdeException(InterruptContext *pContext);
#ifdef _XINHAO
EXTERN_C void DoMachineCheckException(InterruptContext *pContext);
#endif

EXTERN_C int EmulateLoadStoreInsn(InterruptContext *pContext,
                                unsigned long ulAddr, unsigned long ulPc);
EXTERN_C int ComputeReturnEpc(InterruptContext *pContext);
EXTERN_C int DelaySlot(InterruptContext *regs);
EXTERN_C int ReturnInstructionInDelaySlot(InterruptContext *regs);

EXTERN_C void AcknowledgeException();

EXTERN_C bool DoDivZ(InterruptContext * pContext);

#endif // __ELASTOS_EXCEPTION_H__
